#ifndef __REGEXPUTIL_H__
#define __REGEXPUTIL_H__
#include <f32file.h>
#include "deelx.h"
typedef RPointerArray<HBufC> ResultLine;
typedef RPointerArray<ResultLine> ResultList;
typedef struct tag_RegExpNode
{
    int type;
    HBufC8 *regExpString;
} RegExpNode;
typedef struct tag_RegExpLine
{
    RegExpNode *node;
    struct tag_RegExpLine *next;
} RegExpLine;
typedef struct tag_RegExpResultNode
{
    int type;
    union
    {
        ResultLine *line;
        ResultList *list;
    } data;
}RegExpResultNode;
typedef struct tag_RegExpResultLine
{
    struct tag_RegExpResultLine *next;
    RegExpResultNode *node;
}RegExpResultLine;
class CRegExpUtil
{
private:
    static RegExpLine* GetRegExpLineFromFile( RFs &aRfs, const TDesC &fileName);
    static RegExpNode* RegExpNodeAlloc();
    static void RegExpNodeDestroy( RegExpNode *node);
    static RegExpLine* RegExpLineAlloc();
    static void RegExpLineDestroy( RegExpLine *line);
    static ResultLine* ResultLineAlloc();
    static void ResultLineDestroy(ResultLine* line);
    static ResultList* ResultListAlloc();
    static void ResultListDestroy(ResultList *list);
    static RegExpResultNode* RegExpResultNodeAlloc();
    static void RegExpResultNodeDestroy(RegExpResultNode *node);
    static RegExpResultLine* RegExpResultLineAlloc();
    static void AppendLineBuf(MatchResult &matchResult,char *htmlData,ResultLine *line);
public:
    static RegExpResultLine* ResolveHtml(RFs &aRfs,const TDesC &fileName,const TDesC8 &htmlBody);
    static void RegExpResultLineDestroy(RegExpResultLine *line);
};
#endif
